package health_system.health_system.service;


import health_system.health_system.dto.*;
import health_system.health_system.entity.MomentShare;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;
import java.util.Optional;

public interface MomentShareService {
    
    /**
     * Share a moment
     */
    MomentShareDTO shareMoment(MomentShareCreateDTO shareCreateDTO);
    
    /**
     * Update a share
     */
    MomentShareDTO updateShare(Long id, MomentShareUpdateDTO updateDTO);
    
    /**
     * Delete a share
     */
    void deleteShare(Long id);
    
    /**
     * Unshare a moment by user
     */
    void unshareMoment(Long userId, Long originalMomentId);
    
    /**
     * Check if user has shared a moment
     */
    boolean hasUserSharedMoment(Long userId, Long originalMomentId);
    
    /**
     * Get share by ID
     */
    MomentShareDTO getShareById(Long id);
    
    /**
     * Get share entity by ID (for internal use)
     */
    MomentShare getShareEntityById(Long id);
    
    /**
     * Find share entity by ID (optional, for internal use)
     */
    Optional<MomentShare> findShareEntityById(Long id);
    
    /**
     * Get share by user and original moment
     */
    Optional<MomentShareDTO> getShareByUserAndOriginalMoment(Long userId, Long originalMomentId);
    
    /**
     * Get all shares for a moment
     */
    List<MomentShareDTO> getSharesByOriginalMomentId(Long originalMomentId);
    
    /**
     * Get paginated shares for a moment
     */
    PageResponseDTO<MomentShareDTO> getSharesByOriginalMomentId(Long originalMomentId, Pageable pageable);
    
    /**
     * Get all shares by a user
     */
    List<MomentShareDTO> getSharesByUserId(Long userId);
    
    /**
     * Get paginated shares by a user
     */
    PageResponseDTO<MomentShareDTO> getSharesByUserId(Long userId, Pageable pageable);
    
    /**
     * Count shares for a moment
     */
    Long countSharesByOriginalMomentId(Long originalMomentId);
    
    /**
     * Count shares by user
     */
    Long countSharesByUserId(Long userId);
    
    /**
     * Get all users who shared a moment
     */
    List<UserDTO> getUsersWhoSharedMoment(Long originalMomentId);
    
    /**
     * Get paginated users who shared a moment
     */
    PageResponseDTO<UserDTO> getUsersWhoSharedMoment(Long originalMomentId, Pageable pageable);
    
    /**
     * Get moments with most shares visible to user
     */
    List<MomentWithSharesDTO> getMomentsWithMostSharesVisibleToUser(Long viewerId, Pageable pageable);
    
    /**
     * Get recently shared moments by friends
     */
    List<MomentDTO> getRecentlySharedMomentsByFriends(Long userId, Pageable pageable);
    
    /**
     * Find moments by share comment
     */
    List<MomentDTO> findMomentsByShareComment(String searchTerm, Long viewerId);
    
    /**
     * Batch check if user has shared multiple moments
     */
    Map<Long, Boolean> batchCheckUserSharedMoments(Long userId, List<Long> momentIds);
    
    /**
     * Batch get share counts for multiple moments
     */
    Map<Long, Long> batchGetShareCountsForMoments(List<Long> momentIds);
    
    /**
     * Get share statistics by user
     */
    ShareStatsDTO getShareStatsByUser(Long userId);
} 